import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrderQuery, OrderVO,TiktokOrderStatistics } from './types';

// 查询订单列表
export const listOrder = (query: OrderQuery): AxiosPromise<TableInfoVO<OrderVO>> => {
  return request({
    url: '/order/list',
    method: 'get',
    params: query
  });
};

// 订单退款 只有已发货和已完成状态有退款
export const getRefund = (id: string | number) => {
  return request({
    url: `/order/refund/${id}`,
    method: 'POST'
  });
};

// 拦截物流 只有已发货订单有
export const putccanel = (sn: string | number) => {
  return request({
    url: `/order/cancel-deliver/${sn}`,
    method: 'PUT'
  });
};

// 订单详情
export const getdefuis = (id: string | number) => {
  return request({
    url: `/order/${id}`,
    method: 'GET'
  });
};

// 订单物流信息
export const getlogistics = (id: string | number | undefined) => {
  return request({
    url: `/order/logistics/${id}`,
    method: 'GET'
  });
};

// 查询订单统计
export const statisui = (query: OrderQuery): AxiosPromise<TiktokOrderStatistics> => {
  return request({
    url: '/order/statistics',
    method: 'get',
    params: query
  });
};
